﻿@page "/sdk/objects/application/r/{RecordId}/pages"

@model WebVella.Erp.Plugins.SDK.Pages.Application.PagesModel
@{
	Layout = "~/Pages/_AppMaster.cshtml";
	ViewData["Title"] = "Application pages";
}
<wv-page-header color="@Model.App.Color" area-label="Applications" title="@Model.App.Label" subtitle="Pages"
				icon-class="@Model.App.IconClass" return-url="@Model.ReturnUrl">
	<wv-page-header-actions>
		@foreach (var action in Model.HeaderActions)
		{
			@Html.Raw(action)
		}
	</wv-page-header-actions>

	<wv-page-header-toolbar>
		@foreach (var action in Model.HeaderToolbar)
		{
			@Html.Raw(action)
		}
	</wv-page-header-toolbar>
</wv-page-header>

<wv-grid bordered="true" hover="true" columns="Model.Columns" page="Model.Pager" total-count="Model.TotalCount" page-size="Model.PagerSize">
	@foreach (var record in Model.Records)
	{
		<wv-grid-row>
			<wv-grid-column>
				<a href="/sdk/objects/page/r/@record["id"]" class="btn btn-outline-secondary btn-sm" target="_blank"><span class="fa fa-eye"></span></a>
			</wv-grid-column>
			<wv-grid-column>
				@record["weight"]
			</wv-grid-column>
			<wv-grid-column>
				@record["name"]
			</wv-grid-column>
		</wv-grid-row>
	}
	@if (Model.Records.Count == 0)
	{
		<tbody>
			<tr>
				<td colspan="@Model.Columns.Count"><div class="alert alert-info">No pages found</div></td>
			</tr>
		</tbody>
	}
</wv-grid>

